import xadmin

from apps.operations.models import UserAsk,CourseComments,UserFavorite,UserMessage,UserCourse


class UserAskAdmin(object):
    list_display = ["name", "mobile", "courseName","addTime"]
    search_fields = ["name", "mobile", "courseName"]
    list_filter = ["name", "mobile", "courseName","addTime"]

class CourseCommentsAdmin(object):
    list_display = ["user", "course", "comments","addTime"]
    search_fields = ["user", "course", "comments"]
    list_filter = ["user__nickName","course__name","comments","addTime"]

class UserFavoriteAdmin(object):
    list_display = ["user", "favId", "favType","addTime"]
    search_fields = ["user", "favId", "favType"]
    list_filter = ["user__nickName", "favId", "favType","addTime"]

class UserMessageAdmin(object):
    list_display = ["user", "message","hasRead","addTime"]
    search_fields = ["user", "message","hasRead"]
    list_filter = ["user", "message","hasRead","addTime"]

class UserCourseAdmin(object):
    list_display = ["user", "course", "addTime"]
    search_fields = ["user", "course"]
    list_filter = ["user__nickName", "course", "addTime"]

xadmin.site.register(UserAsk,UserAskAdmin)
xadmin.site.register(CourseComments,CourseCommentsAdmin)
xadmin.site.register(UserFavorite,UserFavoriteAdmin)
xadmin.site.register(UserMessage,UserMessageAdmin)
xadmin.site.register(UserCourse,UserCourseAdmin)

